/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Supporter;

import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 *
 * @author Ivan
 */
public class OurSupporter {

    public static boolean isValidInteger(String text) {
        try {
            Integer.parseInt(text);
        } catch (Exception ex) {
            return false;
        }

        return true;
    }

    public static String getFullDateTime(Date date) {
        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        return dateFormat.format(date);
    }

    public static String getPercentString(double percent) {
        DecimalFormat df = new DecimalFormat("0.00%", DecimalFormatSymbols.getInstance(Locale.JAPAN));
        return df.format(percent);
    }

    public static String createErrorString(Object invoker, Exception ex) {
        return "Error in " + invoker.toString() + ": " + ex.getMessage();
    }
}
